﻿using com.nm.library.Excels.Helper;
using System.Collections.Concurrent;

namespace com.nm.library.Excels
{
    /// <summary>
    /// Excel导入数据对应类型枚举
    /// </summary>
    public enum ExcelImportType
    {
        /// <summary>
        /// 货架基本信息
        /// </summary>
        BASESHELF = 0,

        /// <summary>
        /// 货架陈列信息
        /// </summary>
        SHELFDISPLAY = 1,

        /// <summary>
        /// 货架陈列明细信息
        /// </summary>
        SHELFDISPLAYDETAIL = 2,

        /// <summary>
        /// 店铺基本信息表
        /// </summary>
        SHOP = 3,

        /// <summary>
        /// 店铺货架明细表
        /// </summary>
        SHOPSHELF = 4,

        /// <summary>
        /// 补货需求单
        /// </summary>
        SUPPLY = 5,

        /// <summary>
        /// 核心码
        /// </summary>
        DWSIZETYPE = 6,

        /// <summary>
        /// 智能补货
        /// </summary>
        REPLENISHMENT = 7,

        /// <summary>
        /// SKC畅滞销状态
        /// </summary>
        STATESKC = 8,

        /// <summary>
        /// 辅助数据
        /// </summary>
        SECONDARYDATA = 9,

        /// <summary>
        /// 上新计划
        /// </summary>
        PLBASSALEPLAN = 10,

        /// <summary>
        /// 单店毛利率
        /// </summary>
        PLBASSHOPGROSSRATE = 11,

        /// <summary>
        /// 店铺更新系数
        /// </summary>
        PLBASSHOPUPDATERATE = 12,

        /// <summary>
        /// 推台配置表
        /// </summary>
        PLBASTABLECONF = 13,

        /// <summary>
        /// 店间调拨需求表
        /// </summary>
        DWALLOCATIONREQUIRE = 14,

        /// <summary>
        /// 企划结果汇总导出
        /// </summary>
        PLITEMSKCFORPC = 15,

        /// <summary>
        /// 企划唯一码报表
        /// </summary>
        PLONLYCODE = 16,

        /// <summary>
        /// 店铺首配深度
        /// </summary>
        DCBASFIRSTDCQTY = 17,

        /// <summary>
        /// 配货企划订单量
        /// </summary>
        PLANORDERQUANTITY = 18,

        /// <summary>
        /// 城市品类码比
        /// </summary>
        DCBASCITYSIZERATE = 19,

        /// <summary>
        /// 店铺最低深度
        /// </summary>
        DCBASMODELMINQTY = 20,

        /// <summary>
        /// 企划订单量计算
        /// </summary>
        PLANNINGORDERQUANTITY = 21,

        /// <summary>
        /// 企划-周SKC数量
        /// </summary>
        PLSHOPSERIESSKC = 22,

        /// <summary>
        ///店铺陈列SKC
        /// </summary>
        SHOPSKCEXCEL = 23,

        /// <summary>
        /// 销售数据
        /// </summary>
        SALEQUERY = 24,

        /// <summary>
        /// 调出店铺
        /// </summary>
        NEWODSERPTMPCALCSTOCK = 25,

        /// <summary>
        /// 生产订单对应仓库
        /// </summary>
        PRODUCTIONORDERWAREHOUSE = 26,

        /// <summary>
        /// 店铺抢货结果
        /// </summary>
        PICKINGOPERATIONS = 27,

        /// <summary>
        /// 调拨结果
        /// </summary>
        NEWMVJOBMESSAGE = 28,

        /// <summary>
        /// 企划订单量计算
        /// </summary>
        NEWPLANNINGORDERQUANTITY = 29,

        /// <summary>
        /// 城市间物流天数设置
        /// </summary>
        CITYLOGISTICSSETTINGS = 30,

        /// <summary>
        /// 调拨结果明细
        /// </summary>
        NEWGOODSMVJOBMESSAGE = 31,

        /// <summary>
        /// 订货需求
        /// </summary>
        ORDERSKCREQUIRE = 32,

        /// <summary>
        /// 款号设置
        /// </summary>
        ORDERSTYLEDETAIL = 33,

        /// <summary>
        /// 调拔结果统计
        /// </summary>
        STATISTICSRESULT = 34,

        /// <summary>
        /// 端头成列量设置
        /// </summary>
        ENDSDISPLAYMEASURE = 35,

        /// <summary>
        /// 配件中包装
        /// </summary>
        SKCSIZETYPE = 36,

        /// <summary>
        /// 店铺补货限制
        /// </summary>
        MATSUPPLESHOP = 37,

        /// <summary>
        /// 单品有效计算
        /// </summary>
        GOODSSINGLEVALIDCALC = 38,

        NDWKNOCKMATSET=39,

        /// <summary>
        /// 翻单量计算
        /// </summary>
        GOODSREORDERTOTALDEMAMD = 40,

        /// <summary>
        /// 翻单量计算辅助信息
        /// </summary>
        GOODSREORDERTOTALDEMAMDITEM = 41,

        /// <summary>
        /// 新品下单计算
        /// </summary>
        GOODSNEWGOODSORDERS = 42,

        /// <summary>
        /// 新品下单计算辅助信息
        /// </summary>
        GOODSNEWGOODSORDERSITEM = 43,

        /// <summary>
        /// 店铺规划SKC
        /// </summary>
        DWSHOPSTANDARSKC = 44,

    }

    /// <summary>
    /// 模板类
    /// </summary>
    public class ExcelImporMapper
    {
        /// <summary>
        /// 业务类型模板文件路径缓存
        /// </summary>
        private static ConcurrentDictionary<ExcelImportType, string> _fileMappingDict = null;

        /// <summary>
        /// 根据业务类型获取模版文件路径
        /// </summary>
        /// <param name="type">业务类型</param>
        /// <returns>模版文件路径</returns>
        public static string GetTemplatePath(ExcelImportType type)
        {
            InitMapping();
            return _fileMappingDict[type];
        }

        /// <summary>
        /// 初始化模版文件路径缓存
        /// </summary>
        private static void InitMapping()
        {
            if (_fileMappingDict != null) return;
            _fileMappingDict = new ConcurrentDictionary<ExcelImportType, string>();
            _fileMappingDict.TryAdd(ExcelImportType.BASESHELF, FileHelper.GetAbsolutePath("/Template/Excel/货架基本信息.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SHELFDISPLAY, FileHelper.GetAbsolutePath("/Template/Excel/货架陈列信息.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SHELFDISPLAYDETAIL, FileHelper.GetAbsolutePath("/Template/Excel/货架陈列明细信息.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SHOP, FileHelper.GetAbsolutePath("/Template/Excel/店铺基本信息表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SHOPSHELF, FileHelper.GetAbsolutePath("/Template/Excel/店铺货架明细表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SUPPLY, FileHelper.GetAbsolutePath("/Template/Excel/补货需求单.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DWSIZETYPE, FileHelper.GetAbsolutePath("/Template/Excel/城市核心码.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.REPLENISHMENT, FileHelper.GetAbsolutePath("/Template/Excel/智能补货结果.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.STATESKC, FileHelper.GetAbsolutePath("/Template/Excel/SKC畅滞销状态.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SECONDARYDATA, FileHelper.GetAbsolutePath("/Template/Excel/辅助数据.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLBASSALEPLAN, FileHelper.GetAbsolutePath("/Template/Excel/上新计划表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLBASSHOPGROSSRATE, FileHelper.GetAbsolutePath("/Template/Excel/单店毛利率.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLBASSHOPUPDATERATE, FileHelper.GetAbsolutePath("/Template/Excel/店铺更新系数.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLBASTABLECONF, FileHelper.GetAbsolutePath("/Template/Excel/推台配置表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DWALLOCATIONREQUIRE, FileHelper.GetAbsolutePath("/Template/Excel/店间调拨需求表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLITEMSKCFORPC, FileHelper.GetAbsolutePath("/Template/Excel/企划结果汇总表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLONLYCODE, FileHelper.GetAbsolutePath("/Template/Excel/企划唯一码报表.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DCBASFIRSTDCQTY, FileHelper.GetAbsolutePath("/Template/Excel/店铺首配深度.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLANORDERQUANTITY, FileHelper.GetAbsolutePath("/Template/Excel/配货企划订单量.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DCBASCITYSIZERATE, FileHelper.GetAbsolutePath("/Template/Excel/城市品类码比.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DCBASMODELMINQTY, FileHelper.GetAbsolutePath("/Template/Excel/店铺深度.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLANNINGORDERQUANTITY, FileHelper.GetAbsolutePath("/Template/Excel/企划订单量计算.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PLSHOPSERIESSKC, FileHelper.GetAbsolutePath("/Template/Excel/企划周SKC数量.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SHOPSKCEXCEL, FileHelper.GetAbsolutePath("/Template/Excel/店铺陈列SKC.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SALEQUERY, FileHelper.GetAbsolutePath("/Template/Excel/销售数据.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.NEWODSERPTMPCALCSTOCK, FileHelper.GetAbsolutePath("/Template/Excel/调出店铺.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PRODUCTIONORDERWAREHOUSE, FileHelper.GetAbsolutePath("/Template/Excel/生产订单对应仓库.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.PICKINGOPERATIONS, FileHelper.GetAbsolutePath("/Template/Excel/店铺抢货结果.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.NEWMVJOBMESSAGE, FileHelper.GetAbsolutePath("/Template/Excel/调拨结果.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.NEWPLANNINGORDERQUANTITY, FileHelper.GetAbsolutePath("/Template/Excel/企划订单量计算.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.CITYLOGISTICSSETTINGS, FileHelper.GetAbsolutePath("/Template/Excel/城市间物流天数.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.NEWGOODSMVJOBMESSAGE, FileHelper.GetAbsolutePath("/Template/Excel/调拨结果明细.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.ORDERSKCREQUIRE, FileHelper.GetAbsolutePath("/Template/Excel/订货需求.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.ORDERSTYLEDETAIL, FileHelper.GetAbsolutePath("/Template/Excel/款号设置.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.STATISTICSRESULT, FileHelper.GetAbsolutePath("/Template/Excel/调拔结果统计.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.ENDSDISPLAYMEASURE, FileHelper.GetAbsolutePath("/Template/Excel/端头陈列量设置.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.SKCSIZETYPE, FileHelper.GetAbsolutePath("/Template/Excel/配件中包装.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.MATSUPPLESHOP, FileHelper.GetAbsolutePath("/Template/Excel/店铺补货限制.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.GOODSSINGLEVALIDCALC, FileHelper.GetAbsolutePath("/Template/Excel/单品有效计算.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.NDWKNOCKMATSET, FileHelper.GetAbsolutePath("/Template/Excel/淘汰品设置.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.GOODSREORDERTOTALDEMAMD, FileHelper.GetAbsolutePath("/Template/Excel/翻单量计算.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.GOODSNEWGOODSORDERS, FileHelper.GetAbsolutePath("/Template/Excel/新品下单计算.xls"));
            _fileMappingDict.TryAdd(ExcelImportType.DWSHOPSTANDARSKC, FileHelper.GetAbsolutePath("/Template/Excel/店铺规划SKC.xls"));
        }
    }
}